package com.woniuxy.util;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class DongTaiManagerServiceImpl {
    public static Object getObject(Object obj){
        Object o = Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), new InvocationHandler() {
            @Override
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                System.out.println("方法执行一次。" + method.getName());
                Object invoke = method.invoke(obj, args);
                System.out.println("方法结束。");
                return invoke;
            }
        });
        return o;
    }
}
